package cn.iocoder.yudao.module.promotion.gift.controller.app;

import cn.iocoder.yudao.framework.business.basic.controller.PageController;
import cn.iocoder.yudao.framework.business.basic.controller.SimpleDetailController;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.api.promotion.gift.dto.GiftActivityVO;
import cn.iocoder.yudao.module.promotion.gift.pojo.dto.AppGiftActivityQueryDTO;
import cn.iocoder.yudao.module.promotion.gift.service.app.AppGiftActivityService;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.annotation.security.PermitAll;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

@Tag(name = "用户 App - 赠品活动")
@RestController
@RequestMapping("/promotion/gift/activity")
@Validated
public class AppGiftActivityController implements SimpleDetailController<GiftActivityVO>, PageController<GiftActivityVO, AppGiftActivityQueryDTO> {

    @Resource
    private AppGiftActivityService appGiftActivityService;

    @PermitAll
    @Override
    public CommonResult<GiftActivityVO> getDetail(Long id) {
        return success(appGiftActivityService.getDetail(id));
    }

    @PermitAll
    @Override
    public CommonResult<PageResult<GiftActivityVO>> getPage(Integer pageNo, Integer pageSize, AppGiftActivityQueryDTO param) {
        return success(appGiftActivityService.getPage(pageNo, pageSize, param));
    }

}
